<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="java.util.List"%> 
<%@ page import="java.text.SimpleDateFormat"%> 
<%@ page import="com.nmes.naljava.entity.*"%>
<%
	//Account account = (Account)request.getAttribute("list");  // 단일 정보
	
	List<Account> list = (List<Account>)request.getAttribute("list"); //리스트 객체를 전달 받는다.
	SimpleDateFormat sdf = new SimpleDateFormat("M/d/yyyy");
%>
<html> 
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<title>날자바 리스트</title>
</head> 
<body>
	<% if (list.size() > 0) { %>
		<span class="heading">리스트가 <%= list.size() %> 개 있습니다.</span>
		<p/>
		<table border="0" cellspacing="1" cellpadding="5" bgcolor="#CCCCCC" >
		<tr bgcolor="#407BA8"> 
			<td style="color: #ffffff; font-weight: bold;">제목</td> 
			<td style="color: #ffffff; font-weight: bold;">카테고리</td>
			<td style="color: #ffffff; font-weight: bold;">내용</td>
			<td style="color: #ffffff; font-weight: bold;">이미지</td> 
			<td style="color: #ffffff; font-weight: bold;">작성자</td>
			<td style="color: #ffffff; font-weight: bold;">수정</td>
			<td style="color: #ffffff; font-weight: bold;">삭제</td>  
		</tr>		
		<% for (int i = 0;i<list.size();i++) { %>
			<% Account a = (Account)list.get(i); %>
			<tr style="background:#ffffff" onMouseOver="this.style.background='#eeeeee';" onMouseOut="this.style.background='#ffffff';">
				<td><a href="SaveData?action=singleBoard&id=<%= a.getId() %>"><%=a.getTitle() %></a></td>
				<td><%= a.getCategory() %></td> 
				<td><%= a.getContent() %></td> 
				<td> <img src="/ImageSource?id=<%= a.getId() %>" height = 100 width = 200/> </td>
				<td><%= a.getWriter() %></td>
				<td><a href="SaveData?action=updateBoardDisplay&id=<%= a.getId() %>">수정</a></td>
				<td><a href="SaveData?action=deleteBoard&id=<%= a.getId() %>">삭제</a></td>
			</tr> 
		<% } %>
		</table>
	<% } else { %> 
		<span class="heading">내용이 없습니다.</span>
	<% } %> 
	<p/>
</body> 
</html>